import axios from 'axios'
import cookie from 'js-cookie'
import { MessageBox, Message } from 'element-ui'
//创建axios实例
const service = axios.create({
    baseURL: 'http://localhost:9001',//api得base_url
    timeout: 20000
})

service.interceptors.request.use(
    config => {
        //debugger
        //判断cookie里面是否有名称是guli_token数据
        if (cookie.get('guli_token')) {
            //把cookie值放到header里面
            config.headers['token'] = cookie.get('guli_token');
        }
        return config
    },
    err => {
        return Promise.reject(err);
    })
export default service